package net.sourceforge.jweb.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

public class ExceptionBuilder {
	private ExceptionBuilder() {
	}

	public static String buildStack(Throwable t) {
		ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
		PrintStream printStream = new PrintStream(arrayOutputStream);
		t.printStackTrace(printStream);
		String ret = arrayOutputStream.toString();
		try {
			arrayOutputStream.close();
			printStream.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return ret;
	}
}
